/*
-----------------------------------------------------------------------------
This source file is part of Labor3D
(Labor 3D Graphics Engine)

Copyright (c) 2011-2020 Rock Mao
* creator : Rock Mao
* created : 2011-6-27   22:29
* filename: LaborD3D11InputLayout.h
-----------------------------------------------------------------------------
*/

#ifndef __LABORD3D11INPUTLAYOUT_H__
#define __LABORD3D11INPUTLAYOUT_H__
#include "Renderer/LaborInputLayout.h"
#include "LaborD3D11Headers.h"
using namespace std;

NAMESPACE_LABOR3D_BEGIN
	class CLD3D11RenderSystem;
class CLD3D11InputLayout : public ILInputLayout
{
	CLD3D11RenderSystem  *m_pRenderSys;
	wstring                             m_Name;
	size_t                                m_HashName;
	CLInputLayoutDesc          m_Desc;
	ID3D11InputLayout*        m_D3D11InputLayout;
public:
	CLD3D11InputLayout(CLD3D11RenderSystem  *pRenderSys, const wchar_t* name , CLInputLayoutDesc& desc);
	~CLD3D11InputLayout();
	const CLInputLayoutDesc& desc() const;
	const wchar_t*          name() const;
	const size_t            hash_name() const;
	bool                    create() ;
	CLInputLayoutDesc&      layoutDesc(){return m_Desc ; }

public:
	ID3D11InputLayout*      d3D11Layout(){ return m_D3D11InputLayout; }
protected:
	D3D11_INPUT_ELEMENT_DESC* _createInputElementDesc(CLInputLayoutDesc  &   desc , std::wstring& inputDecl) ;
	void                      _releaseInputElementDesc(D3D11_INPUT_ELEMENT_DESC* pIED , int nElement);

};

NAMESPACE_LABOR3D_END

#endif //__LABORD3D11INPUTLAYOUT_H__
